<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.LinkedHashMap" %>
		
		<%
		
	 	Map<String, Double> result3 = new LinkedHashMap<String, Double>();
     	double container3 = 0;
     	String title3 = "";
     	String subTitle3 = "";

     	container3 = (Double) session.getAttribute("container");
     	title3 = (String) session.getAttribute("title");
     	subTitle3 = (String) session.getAttribute("subtitle");
     	result3 = (Map<String, Double>) session.getAttribute("result");  

     	
			double totalCount=0.0;
		 Iterator it5 = result3.entrySet().iterator();

		    while (it5.hasNext()) {
		        Map.Entry pairs = (Map.Entry)it5.next();
		    	String typeName = (String) pairs.getKey();
		    	totalCount = totalCount + (Double) pairs.getValue();
		    }
		    
		    totalCount = totalCount * 100;
		    totalCount = Math.round(totalCount);
		    totalCount = totalCount / 100;
		
		%>
	
		<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
		<script type="text/javascript">
		$(function () {
		    var chart;
		    $(document).ready(function() {
		    	
		    	<% if(container3==0){ %>
		    	// Radialize the colors
				Highcharts.getOptions().colors = $.map(Highcharts.getOptions().colors, function(color) {
				    return {
				        radialGradient: { cx: 0.5, cy: 0.3, r: 0.7 },
				        stops: [
				            [0, color],
				            [1, Highcharts.Color(color).brighten(-0.3).get('rgb')] // darken
				        ]
				    };
				});
				<% } %>
				// Build the chart
		        chart = new Highcharts.Chart({
		            chart: {
		                renderTo: 'container<%=container3%>',
		                plotBackgroundColor: '#FFFFFF',
		                plotBorderWidth: null,
		                plotShadow: false,
		             
		            },
		            title: {
		                text: '<%=title3%>'
		            },
		            subtitle: {
		                text: '<%=subTitle3%> : Total <%=totalCount%>'
		            },
		            tooltip: {
		        	    pointFormat: '{series.name}: <b>{point.percentage}%</b>',
		            	percentageDecimals: 1
		            },
		            plotOptions: {
		                pie: {
		                    allowPointSelect: true,
		                    cursor: 'pointer',
		                    dataLabels: {
		                        enabled: false
		                    },
		                    showInLegend: true,
		                    legend: {
		                        layout: 'vertical',
		                        backgroundColor: '#f0f7fb',
		                        align: 'left',
		                        verticalAlign: 'top',
		                        x: 100,
		                        y: 70,
		                        floating: true,
		                        shadow: true
		                    },
		                }
		            },
		            series: [{
		                type: 'pie',
		                name: 'Percent',
		                data: [
<%

Iterator it4 = result3.entrySet().iterator();

while (it4.hasNext()) {
    Map.Entry pairs = (Map.Entry)it4.next();
	String typeName = (String) pairs.getKey();
	double value = (Double) pairs.getValue();
	%>
	['<%=typeName%>',<%=value%>] <% if(it4.hasNext()){ %>,<%}
	
	
}
%>

		                ]
		            }]
		        });
		    });
		    
		});
		</script>
	
<script src="../Scripts/highcharts/js/highcharts.js"></script>
<script src="../Scripts/highcharts/js/modules/exporting.js"></script>

<div id="container<%=container3%>" style="min-width: 400px; height: 400px; margin: 0 auto"></div>

